﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Facebook;
using LikeUs.WebService.Client;
using LikeUs.WebService.Client.WSInfoClient;
using System.Web.Security;

namespace LikeUsWebSite.Account
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           // RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode("../Learning.aspx");
            if (Request.QueryString["action"] == "logout")
            {
                Session.Abandon();
                Session.Clear();
                FormsAuthentication.SignOut();
                Response.Redirect("../Default.aspx");
                return;
            }
        }

        protected void LoginUser_LoggedIn(object sender, EventArgs e)
        {
            Session.Timeout = 180;
            WSInfoProxy wsProxy = new WSInfoProxy();
            UserData user = wsProxy.GetUser(Int32.Parse(Membership.GetUser().Comment), null);
            Session["userData"] = user;
            wsProxy.userRelationsRoutine(user);
        }
    }
}
